<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php");
	include("function/function.php");
	
	$newsid = trim($_REQUEST['newsid']);
	if(is_numeric($newsid)){
		$sql="select * from kboy_news where news_language=1 and id=$newsid";
		$rows=mysql_query($sql);
		$nums=mysql_num_rows($rows);
		if($nums>0){
			$rs=mysql_fetch_array($rows);
				$news_title = $rs['news_title'];
				$news_writer = $rs['news_writer'];
				$news_from = $rs['news_from'];
				$news_pic = $rs['news_pic'];
				$news_bigclass = $rs['news_bigclass'];
				$classid = $rs['news_bigclass'];
				$news_addtime = $rs['news_addtime'];
				$news_content = stripslashes($rs['news_content']);
				$news_keywords = $rs['news_keywords'];
				$classid = $rs['news_bigclass'];
				$news_hit = $rs['news_hit'];
				$news_tourls = $rs['news_tourls'];
		}else{
			echo erro("该信息已被删除或不存在");
		}
	}else{
		echo erro("该信息已被删除或不存在");
	}
	
	$sql="select * from kboy_bigclass where id=$news_bigclass";
	$rows=mysql_query($sql);
	$nums=mysql_num_rows($rows);
	if($nums>0){
		$rs=mysql_fetch_array($rows);
		$bigclass_cn = $rs['bigclass_cn'];
		
	}else{
		echo erro("该信息已被删除或不存在");
	}
	
	if($news_tourls){ // 设置转页
		echo "<meta http-equiv=\"Refresh\" content=\"0;URL=".$news_tourls."\" />";
		echo re($news_tourls);
	}
	
	// 获取父ID串
	$replace_str = "1,2,3";
	getFatherID($classid,"");
	$getFatherID = $getFatherID . ",";
	$EXarr = explode(',',$replace_str);
	foreach($EXarr as $u){
		$rep_str = ','.$u.",";
		$getFatherID = str_replace($rep_str,'',$getFatherID);
	}
	$getFatherID = rtrim(ltrim($getFatherID,','),',');
	if(strlen($getFatherID)>0){
		$Farr = array_reverse(explode(",",$getFatherID));
		$FarrNum = $Farr[0];
	}
	mysql_query("update kboy_news set news_hit = news_hit + 1 where id=$newsid");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?= $news_title ?>_<?= $web_titles?></title>
<meta name="Keywords" content="<?= $news_title ?>,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/zixun.css" />
</head>
<body>
  <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
  <!--top-bar end-->
  <!--header begin-->
	<? include("_include.top.navbar.php") ?>
  <!--header end-->
  <!-- 主体内容 begin-->
  <div class="l-container-wrap">
    <div class="content">
	  <? include("_include.news.banners.php") ?>
      <div class="l-main">
        <div class="l-main-nav">
          <div class="l-nav">
            <div class="l-nav-right">
              <ul class="ul2">
                <li>当前位置：</li>
				<?php
						if(strlen($getFatherID)>0){
							$arr = explode(",",$getFatherID); 
							foreach(array_reverse($arr) as $v){ 
								echo "<li><a href=\"".getClassName("kboy_bigclass","bigclass_urls","id=$v")."\">".getClassName("kboy_bigclass","bigclass_cn","id=$v")."</a> > </li>";  
							} 
						}
				?>
              </ul>
            </div>
          </div>
        </div>
        <!-- 热门新闻 户外知识 CVA新闻 的内容  这三个在 l-main-content 中tab切换-->
        <div class="l-main-content show">
          <div class="l-bd c">
            <div class="l-bd-left">
                <div class="l-news-detail">
                  <div class="l-detail">
                    <div class="detail-main">
                      <div class="main-title">
                        <h2><?=$news_title?></h2>
                        <div class="title-intro">
                          <span>来源： <?=$news_from?></span>
                          <span>作者： <?=$news_writer?></span>
                          <span>时间：<?=$news_addtime?></span>
                          <ul>
                            <li class="li1"><a href="javascript:void(0)" title=""><img src="images/l-con1.png" alt=""><?=$news_hit?></a></li>
                            
                          </ul>
                          <span class="share"><i></i>分享<div class="bshare-custom"><a title="更多平台" class="bshare-more bshare-more-icon more-style-addthis" style="width:100%;opacity:0;filter:alpha(opacity=0);"></a></div></span>
                        </div>
                      </div>
                      <div class="main-list">
                        <div class="list-top">
					  <?=$news_content?>
                        </div>
                      </div>
                    </div>
                    <div class="detail-interest">
                      <h2>感兴趣的文章</h2>
                      <div class="interest-list">
                        <ul class="c">
						  <?php
						  		$news_sql = "select * from kboy_news where news_bigclass=$classid and id not in($newsid) order by news_top desc,news_order desc, id desc limit 6";
								$news_rows = mysql_query($news_sql);
								while($news_rs = mysql_fetch_array($news_rows)){
						  ?>
                          <li><a href="newsview.php?newsid=<?=$news_rs['id']?>"  target="_blank"><?=getTitleStyle("kboy_news",$news_rs['id'],$news_rs['news_title'],25)?></a></li>
						  <?php
								}
						  ?>
                        </ul>
                      </div>
                    </div>
					
					
<link rel="stylesheet" href="SunbeamEditor/themes/default/default.css" />
<script charset="utf-8" src="SunbeamEditor/kindeditor.js"></script>
<script charset="utf-8" src="SunbeamEditor/lang/zh_CN.js"></script>
<script language="javascript">
	KindEditor.ready(function(K) {
		var editor = K.create('textarea[name="message_text"]', {
			cssPath : '../../SunbeamEditor/plugins/code/prettify.css',
			uploadJson : '../../SunbeamEditor/php/upload_json.php',
			fileManagerJson : '../../SunbeamEditor/php/file_manager_json.php',
			allowFileManager : false,
			items : [
						'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link'],
			afterBlur: function(){this.sync();}
		});
	});
</script>
					
                    <div class="detail-comment">
                      <div class="comment-top">
                        <div class="top-title c">
                          <h2>说点什么吧..</h2>
							<?php  if($_SESSION['kboy_userid']==''){?>
                          <p><a href="reg.php" class="span-zhuce">注册</a><a href="login.php" class="span-denglu">登录</a></p>
						  <?php
						  		}
						  ?>
                        </div>
						<form name="myform" id="myform" method="post" action="news_messagesave.php?action=add">
						<input type="hidden" id="newsid" value="<?=$newsid?>" name="newsid" />
                        <div class="top-main">
                          <textarea name="message_text" id="message_text"></textarea>
                        </div>
                        <div class="top-foot">
                          <span>验证码：</span>
                          <input type="text" name="message_passcode" value="" id="message_passcode">
                          <em><img src="function/code.php" width="105" height="36" class="reshCode imgCode"/></em>
						  <input type="submit" value="发布" />
                        </div>
						</form>
                      </div>
                    </div>
                    <div class="detail-user">
                      <h2>网友评论</h2>
                      <div class="user-main">
                        <ul>
						<?php
								$SQL = "";
								$pagesize = 10; // 分页数量
								$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值
								if($pageval){
									if(!is_numeric($pageval)){
										echo erro("Page Error");
									}
									if($pageval <= 1){
										$pageval = 1;
									}
									$page = ($pageval-1) * $pagesize;
									$page .= ",";
								}else{
									$pageval = 1;
								}
								
								$pagesql = "select * from kboy_news_message where newsid=$newsid order by id desc";
								$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数
								$pagecount = ceil($pagenum/$pagesize); // 共分多少页
								if($pageval > $pagecount){
									$pageval = $pagecount;
								}
								
								$news_sql = $pagesql." limit $page $pagesize";
								$news_rows = mysql_query($news_sql);
								$i = 1;
								while($news_rs = mysql_fetch_array($news_rows)){
						?>
						
                          <li>
                            <div class="cell c">
                              <div class="left">
                                <a href="forum_news.php?uid=<?=$news_rs['uid']?>" target="_blank"><img src="<?=getClassName("kboy_user","user_face","uid=".$news_rs['uid'])?>" alt=""></a>
                              </div>
                              <div class="right">
                                <h3><a href="forum_news.php?uid=<?=$news_rs['uid']?>" target="_blank"><?=getUserNickName($news_rs['uid'])?></a></h3>
                                <p><?=stripslashes($news_rs['message_text'])?></p>
                                <span><?=$news_rs['message_addtime']?></span>
                              </div>
                            </div>
                          </li>
						 <?php
						 		}
						 ?>
						  
						  
                        </ul>
                      </div>
                    </div>
                    <div class="detail-foot">
						<?php
								if($pagenum > $pagesize){
									echo "<div class=\"pagination\"><ul>";
									$url = "newsview.php?newsid=$newsid";//当前页面
									pagebar($pagecount, $pageval, 7, $url);
									echo "</ul></div>";
								}
						?>
                    </div>
                  </div>
                </div>
            </div>
			
			
			<? include("_include.news.rightbar.php") ?>
			
			
          </div>
        </div>
        <!-- 热门新闻 户外知识 CVA新闻 的内容  这三个在 l-main-content 中tab切换  end-->
      </div>
    </div>
  </div>
  <!-- 主体内容 end-->
	<!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
	<!--foot begin-->
	<!--左侧悬浮 begin-->
	<? include("_include.bottom.leftbar.php") ?>
	<!--左侧悬浮 end-->
	<!--右侧悬浮导航 begin-->
	<? include("_include.bottom.rightbar.php") ?>
	<!--右侧悬浮导航 end-->
<script type="text/javascript" src="js/jquery-1.10.2.min.js" ></script>
<script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
<script type="text/javascript" src="js/main.js" ></script>
<script type="text/javascript" src="js/zixun.js" ></script>

	<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/buttonLite.js#style=-1&amp;uuid=&amp;pophcol=2&amp;lang=zh"></script>
    <script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/bshareC0.js"></script>
    
	<script language="javascript">
	$(document).ready(function(){
		// 刷新验证码
		$(".reshCode").click(function(){
			$(".imgCode").attr("src","function/code.php?nums=" + Math.random());   
		});
		
		// 表单提交
		$("#myform").submit(function(){
			var message_text = $("#message_text").val();
			var message_passcode = $("#message_passcode").val();
			
			// 用户名验证
			if(message_text.replace(/\ /g,"").length<1){
				alert("评论内容不能为空！");
				$("#message_text").focus();
				return false;
			}
			// 验证码验证
			if (message_passcode.replace(/\ /g,"").length<1){
				alert("请正确输入验证码！");
				$("#message_passcode").focus();
				return false;
			}
			if (isNaN(message_passcode.replace(/\ /g,""))){
				alert("请正确输入验证码！");
				$("#message_passcode").focus();
				return false;
			}
		});
		
	});
	</script>

</body>
</html>